<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="templates/common.xhtml">
	<ui:define name="pageTitle">Historique des Réservations</ui:define>
	<ui:define name="pageHeader">
	</ui:define>

	<ui:define name="body">
		<!-- the f:metadata with preRenderView is use to prepare data before displaying page -->
		<f:metadata>
			<f:event type="preRenderView"
				listener="#{basketManagedBean.initialize}" />
		</f:metadata>

		<div class="col-lg-2">
			<h:form class="bs-example form-horizontal">
				<div class="form-group">
					<div class="col-lg-10 col-lg-offset-2">
						<h:commandButton class="btn btn-primary" value="Mon profil"
							action="#{loginManagedBeanSuiteAReservation.monProfil}"
							style="padding-right:36px;padding-left:36px;font-size:16px;" />
					</div>
				</div>
				<div class="form-group">
					<div class="col-lg-10 col-lg-offset-2">
						<h:commandButton class="btn btn-primary" value="Mes réservations"
							action="#{loginManagedBeanSuiteAReservation.mesResa}" style="font-size:16px;" />
					</div>
				</div>
			</h:form>

		</div>
		<div class="col-lg-10">
			<h:form id="form">

				<p:dataGrid var="UneSelection"
					value="#{basketManagedBean.listDesSelections}" columns="1"
					emptyMessage="Pas de sélections">
					<p:growl id="growl" showDetail="true" />
					<p:fieldset legend="#{UneSelection.headername}" toggleable="true"
						toggleSpeed="500" style="h6 small">
						<p:dataGrid var="UneReservation"
							value="#{UneSelection.reservations}" columns="1"
							emptyMessage="Pas de réservations">

							<p:panel header="#{UneReservation.headername}">
								<h:panelGrid columns="2" style="width:100%">
									<h:outputText
										value="Hotel: #{UneReservation.hotelname}  Chambre n° #{UneReservation.chambrenumero}" />
									<p:dataTable var="UneOption"
										value="#{UneReservation.listOptions}"
										emptyMessage="Pas d'options" style="width:200px">
										<f:facet name="header">Options liées à la chambre</f:facet>
										<p:column>
											<f:facet name="header">Nom</f:facet>
											<h:outputText value="#{UneOption.option_name}" />
										</p:column>
										<p:column>
											<f:facet name="header">Prix</f:facet>
											<h:outputText value="#{UneOption.price} euro(s)" />
										</p:column>
										<p:column>
											<f:facet name="header">Quantité</f:facet>
											<h:outputText value="#{UneOption.qte}" />
										</p:column>
										<p:column>
											<p:button disabled="true" icon="ui-icon-circle-close"
												title="Suppression option"></p:button>
										</p:column>
									</p:dataTable>
									<h:outputText
										value="du #{UneReservation.dateDebut} au #{UneReservation.dateFin}" />
									<h:outputText value=" " />
									<h:outputText
										value="Prix chambre #{UneReservation.price} euros" />
									<h:outputText value="Prix total #{UneReservation.total} euros" />
									<h:outputText value=" " />
								</h:panelGrid>
							</p:panel>
						</p:dataGrid>
						<p:panel>
							<p:dataTable var="UneVoiture"
								value="#{UneSelection.voituresReservees}">
								<f:facet name="header">Location voiture</f:facet>
								<p:column>
									<f:facet name="header">Catégorie</f:facet>
									<h:outputText value="#{UneVoiture.categorie.libelle}" />
								</p:column>
								<p:column>
									<f:facet name="header">Marque</f:facet>
									<h:outputText value="#{UneVoiture.marque}" />
								</p:column>
								<p:column>
									<f:facet name="header">Modele</f:facet>
									<h:outputText value="#{UneVoiture.modele}" />
								</p:column>
							</p:dataTable>
							<br/>
							<p:dataTable style="width:50%;" var="UneOption" value="#{UneSelection.optionsReservees}" >
								<p:column >
									<f:facet name="header">Options</f:facet>
									<h:outputText value="#{UneOption.libelle} au prix unitaire de #{UneOption.prixUnitaire} €." />
								</p:column>
							</p:dataTable>
						</p:panel>
					</p:fieldset>
					<p:columnGroup type="footer">
						<p:row>
							<p:column footerText="Montant Total" />
						</p:row>
					</p:columnGroup>
				</p:dataGrid>
			</h:form>
		</div>

	</ui:define>

</ui:composition>
</html>